<%- include bases/header.ejs %>




<div class="container-fluid">
    <div class="row">
        <div class="col-sm-2">

            <%- include bases/leftSliderMenu.ejs %>

        </div>
        <div class="col-sm-10">
            <ol class="breadcrumb">
                <li class="active">商品管理
                </li>
                <li class="active">商品列表
                </li>
            </ol>
            <div class="panel panel-default">
              
			    <div class="panel-heading">
                  编辑商品
                </div>
                <div class="panel-body">
                    <div class="table-responsive input-form">
                        <form action="/doProductEdit" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="_id" value="<%= data._id %>">
                            <ul>
                                <li>  商品名称: <input type="text" name="title" value="<%= data.title %>" /></li>

                                <li>
                                    商品图片: <input id="upload" type="file" name="pic" onchange="showImg(this,'showIMG')" />
                                    <div style="margin: 20px 64px;">
                                        <img id="showIMG" src="/<%= data.pic %>" alt="" width="300">
                                    </div>

                                    <script>
                                        function showImg(fileObj,imgId) {
                                            var file=fileObj.files[0];
                                            var r = new FileReader();
                                            r.readAsDataURL(file);
                                            r.onload = function() {
                                                document.getElementById(imgId).setAttribute("src", this.result);
                                            }

                                        }
                                    </script>
                                </li>
                                <li>  商品价格: <input type="text" name="price" value="<%= data.price %>" /></li>
                                <li>  商品邮费: <input type="text" name="fee" value="<%= data.fee %>" /></li>

                                <li>
                                    商品描述:
                                    <textarea name="description" id="" cols="60" rows="8"><%= data.description %></textarea>
                                </li>

                                <li>
                                    <br/>
                                    <button type="submit" class="btn btn-default">提交</button>
                                </li>

                            </ul>


                        </form>
                    </div>
                </div>


            </div>

        </div>
    </div>
</div>

</body>
</html>